/**
 * Created with Vim7.3 ubuntu12.04
 * @fileOverview : 
 * @author : Lyle
 * @since : 2015-05-05 16:26:33
 * @filename : src/share.js
 * @version : 
 * @description : 
 */


define(["backbone"], function() {
    var share = {}; 

    share.makeError = function(msg) { throw new Error(msg)};
    
    share.removeModule = function(moduleName) {
        delete $Global.cacheModule[moduleName];        
        $('#'+moduleName).remove();   
    };
  
    share.removeAllModule = function() {
        $('.module').each(function(){
            var moduleName = $(this).attr('id');
            share.removeModule(moduleName);
        })
    };

    share.reload= function(bool,moduleName){
        if (bool) {
            this.removeModule(moduleName);
        }
    };
    
    share.reRender = function(bool,id) {
        if (bool) {
           $('#'+id).remove();    
        }
    };  

    share.permission = function(type) {
        var auth = false;
        if (type) {
            if (auth) {
                //跳转到List      
            } 
        } else {
            if (!auth) {
                //跳转到login
            } 
        }
    };

    share.checkAuth = function() {

    };

    return share; 
});
